<?php
if (!defined('IN_SITE')){ die('Hacking attempt!'); }
interface ArticleStaticInter{
	### 功能：通过提交不同的查询语句查找文章记录  参数：$where 查询条件 不带“where” #####
    function getArticleId($where);
	### 功能：通过文章id生成静态，不管该文章是否已经静态过，如果是被删除的文章跳过  参数：$id 记录id #####
    function staticArticlesById($id);
}
class staticarticle implements ArticleStaticInter {
	public $meg='';
	function getArticleId($where){
		global $dbtable,$dbconn;
		if ($where){
			$where = "where $where and Adeleted='n' and Astatic='n'";
		}else {
			$where = "where Adeleted='n' and Astatic='n'";
		}
		$query = "select Articleid from $dbtable->news $where";
		$array = $dbconn->GetOneLineField($query);
		return $array;
	}
	function staticArticlesById($articleId){
		global $outvar,$dbtable,$dbconn;
		if (is_array($articleId)){
			$id = implode(',',$articleId);
		}elseif($id) {
			$id = intval($articleId);
		}else {
			return false;
		}
		$where = "where Articleid in ($id) and  Adeleted='n'";
		$query = "select * from $dbtable->news $where";
		$nowQuery = $dbconn->Query($query);
		while (($row = $dbconn->next_record($nowQuery))){
			assignMore($row);
			$outvar[includeT] = 'index';
			$outfile = SITE_ROOT.'index.html';
			staticFile($outfile);
		}
		return true;
	}
}

?>
